<div class="users index">
    <h2><?php __('Categories');?></h2>

    <div class="actions">
        <ul>
            <li><?php echo $html->link(__('New Category', true), array('action'=>'add')); ?></li>
             <li><?php echo $html->link(__('New Article', true), array('controller'=>'articles','action'=>'add','cate_id' => $parent_id)); ?></li>
        </ul>
    </div>
	<div> 下级频道</div>
    <table cellpadding="0" cellspacing="0">
    <?php
        $tableHeaders =  $html->tableHeaders(array(
                                              'id',
                                              __('title', true),
                                              'parent_id',
                                              'sub',
                                              'updated',
                                              __('Actions', true),
                                             ));
        echo $tableHeaders;

        $rows = array();
        foreach ($Categories AS $channel) {
            $actions  = $html->link(__('Edit', true), array('controller' => 'Categories', 'action' => 'edit', $channel['Category']['id']));
            $actions .= ' ' . $html->link(__('Delete', true), array('controller' => 'Categories', 'action' => 'delete', $channel['Category']['id']), null, __('Are you sure?', true));

            $rows[] = array(
                       $channel['Category']['id'],
                       $channel['Category']['title'],
                       $channel['Category']['parent_id'],
                       $html->link(__('Sub', true), array('controller' => 'Categories', 'action' => 'index', $channel['Category']['id'])),
                       $channel['Category']['updated'],
                       $actions,
                      );
        }

        echo $html->tableCells($rows);
        echo $tableHeaders;
        
       
    ?>
    </table>
    <hr/>
    <table cellpadding="0" cellspacing="0">
    <?php
    if($currentdata)
    {
     	$tableHeaders =  $html->tableHeaders(array(
                                              'id',
                                              __('title', true),
                                              'updated',
                                              __('Actions', true),
                                             ));
        echo $tableHeaders;

        $rows = array();
        
        foreach ($currentdata['Article'] AS $item) {
            $actions  = $html->link(__('Edit', true), array('controller' => 'articles', 'action' => 'edit', $item['id']));
            $actions .= ' ' . $html->link(__('Delete', true), array('controller' => 'articles', 'action' => 'delete', $item['id']), null, __('Are you sure?', true));

            $rows[] = array(
                       $item['id'],
                       $html->link(__($item['title'], true), array('controller' => 'articles','admin'=> false, 'action' => 'view', 'id'=>$item['id'])),
                       $item['updated'],
                       $actions,
                      );
        }

        echo $html->tableCells($rows);
        echo $tableHeaders;
     }
        ?>
        </table>
</div>

